package com.library.cxq.service.impl;


import com.library.cx.dao.Libraryimpl;
import com.library.cx.into.Libary;
import com.library.cx.util.Page;
import com.library.cxq.dao.impl.ReaderDaoImpl;
import com.library.cxq.service.ReaderService;

import java.sql.SQLException;
import java.util.ArrayList;
import java.util.List;

public class ReaderServiceImpl implements ReaderService {
    ReaderDaoImpl readerDao=new ReaderDaoImpl();
    @Override
    public boolean register(Integer reaId, String idCard, String pwd, String name, Integer age, String phone, double price) {
        Integer register = readerDao.register(reaId, idCard, pwd, name, age, phone, price);
        if(register!=1) {
            return false;
        }
        return true;
    }

    @Override
    public boolean login(Integer reaId, String pwd) {
        Integer login = readerDao.login(reaId, pwd);
        if(login!=1) {
            return false;
        }

        return true;
    }

    @Override
    public boolean verification(String phone, String cardId) {
        Integer count = readerDao.verification(phone, cardId);
        if(count==1){
            return true;
        }
        return false;
    }

    /**
     * 找回密码
     * @param cardId
     * @param pwd
     */
    @Override
    public void updatePwd(String cardId, String pwd) {
        readerDao.updatePwd(cardId,pwd);
    }

    /**
     * 修改密码
     * @param id
     * @param pwd
     */
    @Override
    public void updatePwd(Integer id, String pwd) {
        readerDao.updatePwd(id,pwd);
    }

    public  List<Libary> selectBook(String name,String zuo){
        List<Libary> list=readerDao.selectBook(name,zuo);
        return list;
    }
}
